home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
bbs
/
mhis020.zip
/
CALLERS.MH
< prev
next >
Wrap
Text File
|
1996-09-10
|
3KB
|
103 lines
#ifndef __CALLERS_MH
#define __CALLERS_MH
#ifndef __GENERAL_MH
#include "general.mh"
#endif
#ifndef __CALLSETT_MH
#include "callsett.mh"
#endif
#ifndef __DATAFILE_MH
#include "datafile.mh"
#endif
struct _callcriteria {
string: name;
string: city;
unsigned int: min_priv;
unsigned int: max_priv;
string: good_keys;
string: bad_keys;
unsigned int: min_calls;
int: task;
int: good_flags;
int: bad_flags;
};
struct _callers {
long: index;
bool: forward_search;
struct _callcriteria: criteria;
};
struct _callers: callers;
void clear_criteria (Ref struct _callcriteria: c) {
c.name := "*";
c.city := "*";
c.min_priv := 0x0000;
c.max_priv := 0xffff;
c.good_keys := "";
c.bad_keys := "";
c.min_calls := 0;
c.task := -1;
c.good_flags := 0;
c.bad_flags := 0;
}
void read_criteria (int: fd, struct _callcriteria: c) {
c.name := datafile_str (fd);
c.city := datafile_str (fd);
c.min_priv := datafile_long (fd);
c.max_priv := datafile_long (fd);
c.good_keys := datafile_str (fd);
c.bad_keys := datafile_str (fd);
c.min_calls := datafile_long (fd);
c.task := datafile_long (fd);
c.good_flags := datafile_long (fd);
c.bad_flags := datafile_long (fd);
}
void write_criteria (int: fd, struct _callcriteria: c) {
writeln (fd, c.name);
writeln (fd, c.city);
writeln (fd, itostr (c.min_priv));
writeln (fd, itostr (c.max_priv));
writeln (fd, c.good_keys);
writeln (fd, c.bad_keys);
writeln (fd, itostr (c.min_calls));
writeln (fd, itostr (c.task));
writeln (fd, itostr (c.good_flags));
writeln (fd, itostr (c.bad_flags));
}
void read_callers () {
int: fd;
string: line;
if (fileexists (CALLERS_TEMP_FILE) = False) { // If the file doesn't exist,
callers.index := 0;
clear_criteria (callers.criteria);
callers.forward_search := True;
return;
};
fd := open (CALLERS_TEMP_FILE, IOPEN_READ);
callers.index := datafile_long (fd);
callers.forward_search := datafile_long (fd);
read_criteria (fd, callers.criteria);
close (fd);
}
void write_callers () {
int: fd;
fd := open (CALLERS_TEMP_FILE, IOPEN_WRITE | IOPEN_CREATE);
writeln (fd, ltostr (callers.index));
writeln (fd, itostr (callers.forward_search));
write_criteria (fd, callers.criteria);
close (fd);
}
#endif